import request from '@/config/axios'

// 招生计划 VO
export interface BatchVO {
  id: string // 主键
  batchName: string // 计划名称
  year: string // 年度
  recruitStartTime: Date // 计划时间(开始)
  recruitEndTime: Date // 计划时间(结束)
  remark: string // 备注
}

// 招生计划 API
export const BatchApi = {
  // 查询招生计划分页
  getBatchPage: async (params: any) => {
    return await request.get({ url: `/recruit/batch/page`, params })
  },

  // 查询招生计划详情
  getBatch: async (id: string) => {
    return await request.get({ url: `/recruit/batch/get?id=` + id })
  },

  // 新增招生计划
  createBatch: async (data: BatchVO) => {
    return await request.post({ url: `/recruit/batch/create`, data })
  },

  // 修改招生计划
  updateBatch: async (data: BatchVO) => {
    return await request.put({ url: `/recruit/batch/update`, data })
  },

  // 删除招生计划
  deleteBatch: async (id: string) => {
    return await request.delete({ url: `/recruit/batch/delete?id=` + id })
  },

  // 导出招生计划 Excel
  exportBatch: async (params) => {
    return await request.download({ url: `/recruit/batch/export-excel`, params })
  },

  // 查询未来被占用的时间范围 用于新建或修改招生计划时的时间选择限制
  getOccupiedTimeRange: async () => {
    return await request.get({ url: '/recruit/batch/occupied-range' })
  },

  // 获得招生计划下拉列表
  getSelectList: async () => {
    return await request.get({ url: '/recruit/batch/select-list' })
  }
}
